<template>
  <div class="app-container">
    <div class="head-container">
      <div>
        <el-input v-model="query.akb020" clearable size="small" placeholder="服务机构编号" style="width: 170px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <el-select v-model="query.cjt100" clearable size="small" placeholder="参保类型" class="filter-item" style="width: 120px" @change="crud.toQuery">
          <el-option
            v-for="item in cjt100TypeOptions"
            :key="item.key"
            :label="item.display_name"
            :value="item.key"
          />
        </el-select>
        <el-date-picker v-model="query.aae002" type="month" value-format="yyyyMM" format="yyyyMM" placeholder="结算期" class="filter-item" />
        <rrOperation :crud="crud" />
        <el-button
          :loading="crud.downloadLoading"
          :disabled="!crud.data.length"
          size="mini"
          type="warning"
          class="filter-item"
          icon="el-icon-download"
          @click="crud.doExport"
        >导 出</el-button>
      </div>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column prop="akb020" label="服务机构编号" align="center" width="100px" />
        <el-table-column prop="akb021" label="服务机构名称" align="center" width="100px" />
        <el-table-column prop="aae002" label="结算期" align="center" />
        <el-table-column prop="aaa022" label="照护类型" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.aaa022 === '1'">
              机构
            </span>
            <span v-else>
              居家
            </span>
          </template>
        </el-table-column>
        <el-table-column prop="cjt100" label="参保类型" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.cjt100 === '0'">
              职工
            </span>
            <span v-else>
              居民
            </span>
          </template>
        </el-table-column>
        <el-table-column prop="aac003" label="姓名" align="center" />
        <el-table-column prop="aac002" label="身份证" align="center" width="170px" />
        <el-table-column prop="aab034" label="统筹区" align="center" />
        <el-table-column prop="akc192" label="入院日期" align="center" width="100px" />
        <el-table-column prop="akc194" label="出院日期" align="center" width="100px" />
        <el-table-column prop="akc264" label="费用总额" align="center" />
        <el-table-column prop="akc260" label="统筹报销" align="center" />
        <el-table-column prop="akc255" label="账户支付" align="center" />
        <el-table-column prop="akc261" label="个人现金" align="center" />
        <el-table-column prop="aaa005" label="拨付金额" align="center" />
        <el-table-column prop="yl" label="预留" align="center" />
        <el-table-column prop="dqbo" label="当期拨付" align="center" />
        <el-table-column prop="zkc024" label="养老机构录入照护数量" align="center" />
        <el-table-column prop="akc268" label="通过计算实际拨付照护数量" align="center" />
        <el-table-column prop="kjsl" label="护理扣减数量" align="center" />
        <el-table-column prop="hlkjje" label="护理扣减金额" align="center" />
        <el-table-column prop="hckjje" label="耗材扣减金额" align="center" />
        <el-table-column prop="akc265" label="本次理论照护数量" align="center" />
        <el-table-column prop="ckc283" label="扣减天数" align="center" />
        <el-table-column prop="adlTotal" label="ADL总分" align="center" />
        <el-table-column prop="aae013" label="异常备注" width="300px" />
      </el-table>
      <!--分页组件-->
      <pagination />
      <!-- 打印拨付单 -->
    </div>
  </div>
</template>

<script>
import crudPggs from '@/api/business/pggs'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'

const defaultForm = { aae002: null }
export default {
  name: 'Pggs',
  components: { pagination, crudOperation, rrOperation, udOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  dicts: ['ccs'],
  cruds() {
    return CRUD({ title: '照护拨付单', url: 'api/generalQuery/queryWxKb22', idField: 'id', sort: ['aae002,desc', 'akb020,asc'], crudMethod: { ...crudPggs }})
  },
  data() {
    return {
      akb020: '',
      aae002: '',
      aaa022: '',
      cjt100: '',
      aab034: '',
      detailDialog: false,
      value2: '',
      aaa022TypeOptions: [
        { key: '1', display_name: '机构' },
        { key: '2', display_name: '居家' }
      ],
      cjt100TypeOptions: [
        { key: '0', display_name: '职工' },
        { key: '1', display_name: '居民' }
      ],
      permission: {
        add: ['admin', 'pggs:add'],
        edit: ['admin', 'pggs:edit'],
        del: ['admin', 'pggs:del']
      },
      rules: {
        bisGsglQymc: [
          { required: true, message: '企业名称不能为空', trigger: 'blur' }
        ],
        bisGsglTyshxydm: [
          { required: true, message: '统一社会信用代码不能为空', trigger: 'blur' }
        ],
        bisGsglLxr: [
          { required: true, message: '联系人不能为空', trigger: 'blur' }
        ],
        bisGsglLxrdh: [
          { required: true, message: '联系人电话不能为空', trigger: 'blur' }
        ],
        bisGsglSsqx: [
          { required: true, message: '所属区县不能为空', trigger: 'blur' }
        ],
        bisGsglZcdz: [
          { required: true, message: '注册地址不能为空', trigger: 'blur' }
        ]
      },
      queryTypeOptions: [
        { key: 'bisGsglQymc', display_name: '企业名称' },
        { key: 'bisGsglTyshxydm', display_name: '统一社会信用代码' },
        { key: 'bisGsglLxr', display_name: '联系人' },
        { key: 'bisGsglLxrdh', display_name: '联系人电话' },
        { key: 'bisGsglSsqx', display_name: '所属区县' },
        { key: 'bisGsglZcdz', display_name: '注册地址' }
      ]
    }
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    },
    detailCancel() {
      this.detailDialog = false
    }
  }
}
</script>

<style scoped>

</style>
